home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / imgtcl.z / imgtcl
Text File  |  1998-10-30  |  13KB  |  397 lines

  1.  
  2.  
  3.  
  4. iiiimmmmggggttttccccllll((((1111))))                                                            iiiimmmmggggttttccccllll((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiimmmmggggttttccccllll - tcl-based scripting shell for the IL
  10.  
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      iiiimmmmggggttttccccllll [_f_i_l_e_n_a_m_e _a_r_g_1 _a_r_g_2... ]
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The imgtcl shell provides a tcl-based scripting interface to the IL.  IL
  18.      operators and image files can be created, linked together, and displayed
  19.      in an ilViewer or ilDisplay object.  Most of the IL's classes can be be
  20.      created and manipulated within imgtcl; multi-dimensional arrays can also
  21.      be allocated (usually to be used as parameters to an IL function.)
  22.  
  23.  
  24.    IIIInnnnvvvvooookkkkiiiinnnngggg IIIILLLL ffffuuuunnnnccccttttiiiioooonnnnssss
  25.      The various constructors and methods defined by the IL are available as
  26.      imgtcl commands; default values, where defined, are supported by imgtcl.
  27.      If a constructor or method has overloaded versions, then the alternative
  28.      versions will have a slightly different name; these names are shown in
  29.      the header file for that class.  For instance, the iiiillllFFFFiiiilllleeeeIIIImmmmgggg object has
  30.      four different constructors; in imgtcl they are named:
  31.  
  32.           ilFileImgOpen - opens an existing file by name
  33.  
  34.           ilFileImgOpenByDescriptor - opens an existing file by descriptor
  35.  
  36.           ilFileImgCreate - creates a new file
  37.  
  38.           ilFileImgCreateByDescriptor - creates a new file by descriptor
  39.  
  40.      if there is a return value, it will be converted to an ASCII string and
  41.      returned as the value of the command.  Many of the IL functions will
  42.      return a pointer value; it will be converted to the string:
  43.  
  44.           (type-name*)address
  45.  
  46.      where <type-name> is the type of the pointer being returned and address
  47.      is the hex address of the pointer (e.g. "(ilFileImg*)0x00100fe0").
  48.  
  49.  
  50.    CCCCrrrreeeeaaaattttiiiinnnngggg IIIILLLL oooobbbbjjjjeeeeccccttttssss
  51.      In general, class constructors are available as imgtcl commands; the
  52.      syntax is:
  53.  
  54.           <object-type> <name> args
  55.  
  56.      Where <object-type> is the C++ name of the class (or an alternative, if
  57.      the constructor is overloaded), <name> is a unique identifier used to
  58.      name the new object, and args is a list of arguments to the constructor
  59.      (default values as defined in the header file are supported).  The
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiimmmmggggttttccccllll((((1111))))                                                            iiiimmmmggggttttccccllll((((1111))))
  71.  
  72.  
  73.  
  74.      object's name is returned as the value of the command.
  75.  
  76.      For example, the command:
  77.  
  78.           ilFileImgOpen sfoimg /images/sfo.fit
  79.  
  80.      will open the image file "/images/sfo.fit", create an ilFileImg object
  81.      named "sfoimg" and return that name.
  82.  
  83.      As a side effect of creating an IL object, a new imgtcl command is
  84.      created using the object's name.  This command gives access to the C++
  85.      methods of that object's class and its base classes.  For example, after
  86.      the above call to create "sfoimg", the command:
  87.  
  88.           sfoimg getFileName
  89.  
  90.      will return the value "/images/sfo.fit", the name of the file.  Any
  91.      arguments should follow the method name.
  92.  
  93.  
  94.    FFFFuuuunnnnccccttttiiiioooonnnn aaaannnndddd mmmmeeeetttthhhhoooodddd aaaarrrrgggguuuummmmeeeennnnttttssss
  95.      The imgtcl interpreter is aware of the types of each functions's
  96.      arguments, and will try to convert each string argument to the
  97.      appropriate type.  For numeric or string arguments, the conversion is
  98.      simple.  When an argument is an object, imgtcl will accept either the
  99.      name of the object (e.g. "sfoimg") or the object's address, expressed as
  100.      a string (e.g. 0x0010fe80).  Care must be taken when passing literal
  101.      addresses, as an incorrect address can cause a bus error (or other
  102.      unpredictable problems).
  103.  
  104.  
  105.    VVVViiiieeeewwwwiiiinnnngggg iiiimmmmaaaaggggeeeessss
  106.      To view a single image object, just type that object's name on a command
  107.      line by itself; this will create an ilViewer window and display the image
  108.      in that viewer.  While the viewer is active, the imgtcl interpreter will
  109.      be suspended; when the viewer window is closed, the imgtcl prompt will
  110.      again be issued.
  111.  
  112.      When viewing more than one object, the "view" command may be used.  For
  113.      example, if there are image objects "sfoimg" and "convimg", the command
  114.      "view sfoimg convimg" will bring up a viewer with those two images
  115.      displayed, one on top of the other.
  116.  
  117.  
  118.    CCCCrrrreeeeaaaattttiiiinnnngggg aaaarrrrrrrraaaayyyyssss wwwwiiiitttthhhh nnnneeeewwww
  119.      Some methods require array arguments, and imgtcl provides the command
  120.      "new" for the purpose of creating and initializing arrays.  The syntax
  121.      for new is:
  122.  
  123.           new <elem-type> [name] <dims> [= <initializer>]
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiimmmmggggttttccccllll((((1111))))                                                            iiiimmmmggggttttccccllll((((1111))))
  137.  
  138.  
  139.  
  140.      where <elem-type> is the C++ data type of the array elements (the simple
  141.      types int, float, etc are supported, as well as many of the IL's struct
  142.      types); <name> is a variable name that is to receive the address and
  143.      dimension info of the array; <dims> is a list of integers defining the
  144.      size of the array, and <initializer> is a list containing the values used
  145.      to initialize the array.  For multi-dimensional arrays, enclose each
  146.      dimension in a set of braces {}.  If the array elements are structs, list
  147.      the field names in order.
  148.  
  149.      The optional <name> argument shown above can be used to retrieve and set
  150.      the values stored in the array, and to delete the array.
  151.  
  152.      EEEExxxxaaaammmmpppplllleeee::::
  153.  
  154.      imgtcl> new int {2 2} = { {1 2} {3 4} }
  155.  
  156.      This command creates a 2x2 int array and initializes it to contain:
  157.  
  158.      array[0][0] = 1
  159.      array[0][1] = 2
  160.      array[1][0] = 3
  161.      array[1][1] = 4
  162.  
  163.      The next example creates an array of iflXYfloats with the indicated {x,y}
  164.      values, and stores the address and dimension info in the variable "xy";
  165.      this variable is then used to print the values in the array, and then
  166.      change the values stored in the array:
  167.  
  168.      imgtcl> new iflXYfloat xy {3} = { {0 0} {39 71} {266 271} }
  169.      (iflXYfloat {3})0x1000a040
  170.      imgtcl> echo $xy
  171.      (iflXYfloat {3})0x1000a040
  172.      imgtcl> $xy
  173.      {0 0} {39 71} {266 271}
  174.      imgtcl> $xy = { {42 268} {147 264} {265 263} }
  175.      imgtcl> $xy
  176.      {42 268} {147 264} {265 263}
  177.  
  178.      Notice that the "new" command returns the same string that the variable
  179.      "xy" is set to.
  180.  
  181.  
  182.    BBBBuuuuiiiilllltttt----iiiinnnn ccccoooommmmmmmmaaaannnnddddssss
  183.      In addition to the complete external API of IL and IFL, several
  184.      convenient built-in functions are provided.
  185.  
  186.      ttttiiiimmmmeeeessss
  187.  
  188.           times
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiimmmmggggttttccccllll((((1111))))                                                            iiiimmmmggggttttccccllll((((1111))))
  203.  
  204.  
  205.  
  206.           Returns the value returned by the Unix call times(2).
  207.  
  208.      mmmmaaaalllllllloooocccc
  209.  
  210.           malloc _n
  211.  
  212.  
  213.           Returns the pointer resulting from malloc'ing _n bytes.
  214.  
  215.      ffffrrrreeeeeeee
  216.  
  217.           free _p
  218.  
  219.  
  220.           Free the previously malloc'ed pointer.
  221.  
  222.      ggggeeeettttoooopppptttt
  223.  
  224.           getopt _a_r_g_c _a_r_g_v _o_p_t_s_p_e_c
  225.  
  226.  
  227.           Emulate the Unix getopt facility.  The arguments to the command
  228.           include the command-line arguments and a option specifier string.
  229.           The command-line arguments are expected to be in conventional C
  230.           form.  That is, the array _a_r_g_v is zero-indexed with the zero-th
  231.           argument being the command name.  The format of the option specifier
  232.           is described in getopt(3C).
  233.  
  234.           Here is an example:
  235.  
  236.           #!/usr/sbin/imgtcl
  237.           # mangle args to match our getopt expectations
  238.           incr argc
  239.           set argv [linsert $argv 0 $argv0]
  240.           # check for command line options
  241.           while {[string compare [set c [getopt $argc $argv  "ab:c:"]] EOF] != 0} {
  242.               switch $c {
  243.                   a {set aFlag 1}
  244.                   b {set bArg $optarg}
  245.                   c {set cArg $optarg}
  246.               }
  247.           }
  248.           # ... do processing ...
  249.  
  250.  
  251.      xxxxooooppppeeeennnnddddiiiissssppppllllaaaayyyy
  252.  
  253.           xopendisplay _d_i_s_p_N_a_m_e=NULL
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. iiiimmmmggggttttccccllll((((1111))))                                                            iiiimmmmggggttttccccllll((((1111))))
  269.  
  270.  
  271.  
  272.           Returns the X Display pointer associated with _d_i_s_p_l_a_y_N_a_m_e that
  273.           results from the X call XOpenDisplay(3X11).
  274.  
  275.      xxxxcccclllloooosssseeeeddddiiiissssppppllllaaaayyyy
  276.  
  277.           xclosedisplay _p
  278.  
  279.  
  280.           Returns the integer value returned by calling XCloseDisplay(3X11)
  281.           with the previously-opened display pointer _p.
  282.  
  283.      vvvviiiieeeewwww
  284.  
  285.           view _i_m_g_1 ...
  286.  
  287.  
  288.           Display a viewer, similar to imgview(1), one or more image objects.
  289.           The viewer is retained between calls to vvvviiiieeeewwww.  Therefore, its state,
  290.           such as being double- or single-buffered, or being in an RGB or
  291.           pseudo color rendering mode.
  292.  
  293.      ddddiiiissssppppllllaaaayyyy
  294.  
  295.           display _d_i_s_p _w _h
  296.           display _d_i_s_p _i_m_g
  297.  
  298.  
  299.           An ilDisplay object is constructed and returned as the "command"
  300.           named _d_i_s_p.  After the display is constructed, methods on ilDisplay
  301.           can be invoked in the standard manner.
  302.  
  303.      rrrreeeeaaaaddddbbbbaaaacccckkkk
  304.  
  305.           readback _m_e_m _i_m_g
  306.  
  307.  
  308.           The image _i_m_g is displayed and readback into a memory image.  The
  309.           result is readback in the RGBA unsigned byte format, regardless of
  310.           the format of the image.  If the input image has no alpha, the alpha
  311.           channel is initialized to a constant 255.
  312.  
  313.      ttttiiiimmmmeeeeppppaaaaiiiinnnntttt
  314.  
  315.           timepaint _d_i_s_p
  316.  
  317.  
  318.           Precisely time the length of the ppppaaaaiiiinnnntttt() method call on _d_i_s_p.  The
  319.           result is returned in seconds.  This function uses ilTimer(3) to
  320.           time the interval.  Note that the elapsed time to paint the view
  321.           will not include the time to compute outstanding graphics requests.
  322.           A more accurate measurement can be obtained by averaging the paint
  323.           times over a long sequence of painting operations.
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. iiiimmmmggggttttccccllll((((1111))))                                                            iiiimmmmggggttttccccllll((((1111))))
  335.  
  336.  
  337.  
  338.      vvvvkkkkvvvviiiieeeewwww,,,, vvvvkkkkvvvviiiieeeewwwweeeerrrr
  339.  
  340.           malloc n
  341.  
  342.  
  343.           XXX obsolete?
  344.  
  345. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  346.      IL(3), IFL(3), ilImage(3)
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.